package com.itheima.stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;

public class Demo03 {

    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of( "鹿晗", "吴签", "黄子韬","蔡徐坤"));
        Stream<String> stream = Stream.of("谢广坤", "刘能", "王大拿", "赵四", "赵四");
        //limit
        list.stream().limit(2).forEach(s-> System.out.println(s));
        //skip
        list.stream().skip(2).forEach(s-> System.out.println(s));
        //static concat
        Stream.concat(list.stream(),stream).forEach(s-> System.out.println(s));

        //distinct
        Stream.of("谢广坤", "刘能", "王大拿", "赵四", "赵四").distinct().forEach(s-> System.out.println(s));


        list.stream().filter(s->s.length()==2).forEach(s-> System.out.println(s));
       // System.out.println(list);
    }
}
